package com.cedifie.lendapp.ui.loan.impl

import com.cedifie.lendapp.http.ApiService
import com.cedifie.lendapp.http.ApiService.addCommonParams
import com.cedifie.lendapp.http.HttpHelper
import com.cedifie.lendapp.http.IHttpCallback
import org.json.JSONObject

/**
 * Cedifie
 * @Author wwdeng
 * @CreateTime: 2024/6/17 13:45
 * @Annotation：待还款 Model 实现
 */
class CedLoanRepayModelImpl {

    /**
     * 获取贷款额度
     */
    fun loadCedLoanLimitAction(callBack: IHttpCallback){
        val httpUrl = ApiService.getHttpUrl(ApiService.API_URL.CED_API_LOAN_LIMIT_URL)
        val params = JSONObject().addCommonParams().apply {
            put("path", ApiService.API_PATH.CED_API_LIMIT_PATH)
        }
        HttpHelper.postCedAction(httpUrl,params,callBack)
    }

    /**
     * 获取还款信息
     */
    fun loadCedRepayInfoAction(callBack: IHttpCallback){
        val httpUrl = ApiService.getHttpUrl(ApiService.API_URL.CED_API_COMMON_URL)
        val params = JSONObject().addCommonParams().apply {
            put("path", ApiService.API_PATH.CED_API_LOAN_REPAYMENT_INFO_PATH)
        }
        HttpHelper.postCedAction(httpUrl,params,callBack)
    }
    /**
     * 获取还款Url
     */
    fun loadCedPayLinkAction(callBack: IHttpCallback){
        val httpUrl = ApiService.getHttpUrl(ApiService.API_URL.CED_API_COMMON_URL)
        val params = JSONObject().addCommonParams().apply {
            put("path", ApiService.API_PATH.CED_API_LOAN_REPAYMENT_URL_PATH)
        }
        HttpHelper.postCedAction(httpUrl,params,callBack)
    }
}